# coding: utf-8

# In[5]:

import pandas as pd

fandango = pd.read_csv('fandango_score_comparison.csv')
series_film = fandango['FILM']
print(series_film[:5])
series_rt = fandango['RottenTomatoes']
print(series_rt[:5])

# In[10]:

from pandas import Series

film_names = series_film.values
rt_scores = series_rt.values

series_custom = Series(rt_scores, index=film_names)
# print(series_custom)

series_custom[['Minions (2015)', 'Leviathan (2014)']]

# In[11]:

# int index is also avilable
fiveten = series_custom[5:10]
print(fiveten)

# In[13]:

sc2 = series_custom.sort_index()
print(sc2[:10])

sc3 = series_custom.sort_values()
print(sc3[:10])

# In[19]:

# The values in a Series object are treated as an ndarray,
# the core data in NumPy
import numpy as np

print(np.add(series_custom, series_custom)[:10])
# Return the highest value (will return a single vlaue not a Series)
print(np.max(series_custom))

# In[25]:

# print(series_custom > 50)
series_greater_than_50 = series_custom[series_custom > 50]
# print( series_greater_than_50[:10])

criteria_one = series_custom > 50
criteria_two = series_custom < 75
both_criteria = series_custom[criteria_one & criteria_two]
print(len(both_criteria))

# In[31]:

# data alignment same index
rt_critics = Series(fandango['RottenTomatoes'].values, index=fandango['FILM'])
rt_users = Series(fandango['RottenTomatoes_User'].values, index=fandango['FILM'])
rt_mean = (rt_critics + rt_users) / 2
print(rt_mean[:10])


# In[ ]:
